package com.hpradip.android.documentaryHub;


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;

public class EULAActivity extends Activity {
	protected boolean accepted = false;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.eula);

		WebView view = (WebView) findViewById(R.id.web_view);
		view.loadDataWithBaseURL("http://www.google.com", getResources()
				.getString(R.string.EULA_HTML), "text/html", "utf-8", "");

		final Button acceptBtn = (Button) findViewById(R.id.accept_button);
		acceptBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				setResult(RESULT_OK);
				finish();
			}
		});

		CheckBox chkBox = (CheckBox) findViewById(R.id.eula_accept_checkbox);
		chkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				if (isChecked)
					acceptBtn.setEnabled(true);
				else
					acceptBtn.setEnabled(false);
			}
		});

		Button declineBtn = (Button) findViewById(R.id.decline_button);
		declineBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				setResult(RESULT_CANCELED);
				finish();
			}
		});
	}


}
